import Taro, { Component } from '@tarojs/taro';
import { Image, Text, View } from '@doctorwork/components';
import './style.styl';

export default class Popup extends Component {
    static defaultProps = {
        close: true
    };

    close(){
        this.props.onClose();
    }
    stopEvent(e) {
        e.stopPropagation();
    }
    render() {
        return (
            <View className='modal fixed'>
                <View className='modal-mask' onClick={this.close.bind(this)} />
                {this.props.close ? <View className='modal-close' /> : null}
                <View className='modal-content' onClick={this.stopEvent.bind(this)}>{this.props.children}</View>
            </View>
        );
    }
}
